#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>

static int dummy_probe(struct platform_device *pdev)
{
	struct device_node *of_node = pdev->dev.of_node;
	int ret;
	unsigned int val;
	const char *str;
	struct resource *res;

	printk("------- %s ----------\n", __FUNCTION__);

	ret = of_property_read_string_index(of_node, "fuck", 0, &str);
	printk("ret: %x, fuck0 = %s\n", ret, str);

	ret = of_property_read_string_index(of_node, "fuck", 1, &str);
	printk("ret: %x, fuck1 = %s\n", ret, str);

	ret = of_property_read_u32(of_node, "shit", &val);
	printk("ret = %x, shit0 = %#x\n", ret, val);

	ret = of_property_read_u32_index(of_node, "shit", 1, &val);
	printk("ret = %x, shit1 = %#x\n", ret, val);

	ret = of_property_read_string(of_node, "xiba", &str);
	printk("ret: %x, xiba_string = %s\n", ret, str);

	ret = of_property_read_u32_index(of_node, "xiba", 1,&val);
	printk("ret = %x, xiba_u32_0 = %#x\n", ret, val);

	ret = of_property_read_u32_index(of_node, "xiba", 2, &val);
	printk("ret = %x, xiba_u32_1 = %#x\n", ret, val);

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	printk("reg- start: %#x, end: %#x, name: %s, flags: %#lx\n", res->start, res->end, res->name, res->flags);

	return 0;
}

static int dummy_remove(struct platform_device *pdev)
{
	printk("------- %s ----------\n", __FUNCTION__);

	return 0;
}

static struct of_device_id devices[] = {
	{.compatible =  "dummy0", .data = 0},
	{},
};

static struct platform_driver dummy_drv = {
	.probe	= dummy_probe,
	.remove	= dummy_remove,
	.driver	= {
		.name		= "dummy0",
		.owner		= THIS_MODULE,
		.of_match_table	= devices,
	},
};

module_platform_driver(dummy_drv);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("YYW");
